package Homework3;

import java.util.Arrays;
import java.util.Scanner;

public class Homework3_6 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int[] arr1 = new int[n1];

        for (int i = 0; i < n1; i++) {
            arr1[i] = input.nextInt();
        }

        int n2 = input.nextInt();
        int[] arr2 = new int[n2];

        for (int i = 0; i < n2; i++) {
            arr2[i] = input.nextInt();
        }

        int[] arr3 = new int[n1 + n2];
        System.arraycopy(arr1,0,arr3,0,n1);
        System.arraycopy(arr2,0,arr3,n1,n2);

        Arrays.sort(arr3);
        for (int i = 0; i < n1 + n2; i++) {
            System.out.print(arr3[i] + " ");
        }
    }
}
